package cn.wolfcode.trip.base.domain;


import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter@Setter@ToString
public class FriendshipReply  extends BaseDomain{

    public static final Boolean READ_ALREADY=true;//已读
    public static final Boolean READ_UNREAD=false;//未读


    private FriendshipComment friendshipcomment;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
    private Date createTime;

    private User user; //评论人

    private User bereplyuser;//被评论人

    private String content;

    private Boolean read=READ_UNREAD;

    private Friendship friendship;
    public Object getJson(){
        Map<String,Object> map = new HashMap<>();
        if (user != null) {
            map.put("beReplyUserId",user.getId());
            map.put("beReplyUserName",user.getNickName());
        }
        if (friendshipcomment != null) {
            map.put("userCommentId",friendshipcomment.getId());
        }
        if (friendship != null) {
            map.put("friendshipId",friendship.getId());
        }
        map.put("id",id);
        return JSONUtil.toJSONString(map);
    }
}